<?php
include("./app/common.php");

?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $config['site_name']?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="./component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="./component/css/admin.css" media="all">
    <link rel="stylesheet" href="./component/css/login.css" media="all">
</head>
<style type="text/css">
    #LAY-user-login {
        width: 100%;
        height: 100%;
        background-size: 300%;
        animation: bganimation 30s infinite;
        font-family: '@font-face';
    }
    @font-face {
        font-family: 'Nunito';
        font-style: normal;
        font-weight: 400;
        unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
    }

    .FontColor {
        background-image: -webkit-linear-gradient(125deg, #29b9ff, #ff5b40);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        text-align: center;
        font-size: 2em;
        height: 3em;
        line-height: 3em;
        color: #745dff;
    }
    .LoginIcon {color: coral;cursor: pointer;}
    .LgoinBtn {background: #76e633;}
    .LgoinBtnDe {background: #CCCCCC;}
    .visitor {width: 2em;height: 2em;margin: 0em auto;box-shadow: 3px 3px 8px 0px #ccc;border-radius: 30rem;cursor: pointer;margin-top: 0em;}
</style>
<body>
<style>
    @media screen and (max-width: 788px) {
        .nbi {
            width: 94% !important;
            margin-top: -3.5em;
        }
    }
</style>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;width: 100%;height: auto;background-image: url();-webkit-background-size: cover和-o-background-size: cover;">
    <div class="layadmin-user-login-main nbi" style="background-color: white;border-radius: 0.3em;opacity: 0.9;">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2 class="FontColor">夸克广告自助系统</h2>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username"></label>
                <input type="text" name="username" id="username" placeholder="请输入账号" lay-verify="required"  class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password"></label>
                <input name="password" type="password" id="password" placeholder="请输入密码" lay-verify="required"  class="layui-input">
            </div>

            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"></label>
                        <input type="text" name="code" id="code" lay-verify="required"   placeholder="图片验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img id="codeimg" src="./code.php?r=1646282024" height="38" onclick="this.src='./code.php?r='+Math.random();" title="点击更换验证码" class="layadmin-user-login-codeimg">
                        </div>
                    </div>
                </div>
            </div>


            <button class="layui-btn layui-btn-fluid layui-anim layui-anim-upbit" id="submit_login" style="background-color: #ff7235" lay-submit lay-filter="login">登 入</button>

        </div>
    </div>
    <div class="layui-trans layadmin-user-login-footer" style="color: white;">
        <p>© 2022 <a href="/" target="_blank" style="color: white;"><?php echo $config['site_name']?></a></p>
    </div>
</div>
<script src="//lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
<script src="//lib.baomitu.com/layer/2.3/layer.js"></script>
<!-- 资 源 引 入 -->
<script src="component/layui/layui.js"></script>
<script src="component/pear/pear.js"></script>
<script>
    layui.use(['form', 'button', 'popup','jquery'], function() {
        var form = layui.form;
        var button = layui.button;
        var popup = layui.popup;
        let $ = layui.jquery;

        // 登 录 提 交
        form.on('submit(login)', function(data) {
            var index = layer.msg('数据加载中', {time: 9999999});
            $.ajax({
                type: "post",
                url: "auth.php?act=login",
                dataType: "json",
                data: {
                    username: $("#username").val(),
                    code: $("#code").val(),
                    password: $("#password").val()
                },
                success: function (data) {
                    layer.close(index);
                    if (data.code == 1) {
                        layer.msg(data.msg, {icon: 1, time: 2000, shade: 0.4}, function () {
                            location.href = './index.php';
                        });
                    } else {
                        layer.msg(data.msg, {icon: 7, time: 2000, shade: 0.4});
                    }
                },
                error: function () {
                    layer.alert('服务器异常！');
                    layer.close(index);
                }
            });
            return false;
        });
    })
</script>
</body>
</html>
